﻿<?php
#reemo by 2012

class ShowDonationPage extends AbstractPage
{
	public static $requireModule = MODULE_TRADER;
	
	function __construct() 
	{
		parent::__construct();
	}
	
	function send()
	{
	global $USER, $LNG, $LANG, $CONF;
	
		$summa	= HTTP::_GP('sum', 0);
		$valuta	= HTTP::_GP('valuta', '');
		$time_user	= HTTP::_GP('time', '', UTF8_SUPPORT);
		if ($summa != '' && $summa>0)
		{
			$USERname= $USER['username'];
			$Qry = "INSERT INTO ".DONATION." SET 
							id_user = ".$USER['id'].",
							name_user = '".$GLOBALS['DATABASE']->sql_escape($USERname)."',
							sum = ".$summa.",
							valuta = '".$valuta."',
							kurs = ".$CONF[$valuta].",
							x_donation = ".$CONF['x_donation'].",  
							time_user = '".$GLOBALS['DATABASE']->sql_escape($time_user)."',  
							status = 0,
							time = ".TIMESTAMP .";";
			$GLOBALS['DATABASE']->query($Qry);
			$this->printMessage($LNG['senk'] , array("game.php?page=donations", 2));
		}
	}
	public function show() 
	{
		global $USER, $LNG, $LANG, $db, $CONF;
		
		


// регистрационная информация (логин, пароль #1)
// registration info (login, password #1)
$mrh_login = "demo";
$mrh_pass1 = "password_1";

// номер заказа
// number of order
$inv_id = 0;

// описание заказа
// order description
$inv_desc = "Техническая документация по ROBOKASSA";

// сумма заказа
// sum of order
$out_summ = "8.96";

// тип товара
// code of goods
$shp_item = 1;

// предлагаемая валюта платежа
// default payment e-currency
$in_curr = "";

// язык
// language
$culture = "ru";

// кодировка
// encoding
$encoding = "utf-8";

// формирование подписи
// generate signature
$crc  = md5("$mrh_login:$out_summ:$inv_id:$mrh_pass1:Shp_item=$shp_item");



			
		$this->tplObj->loadscript("trader.js");
		$this->tplObj->assign_vars(array(
			'ur1' 		=> 10000,
			'ur2' 		=> 20000,
			'ur3' 		=> 50000,
			'ur4' 		=> 100000,
			'ur5' 		=> 150000,
			'ur6' 		=> 200000,
			'wmr' 		=> $CONF['WMR'],
			'wmz' 		=> $CONF['WMZ'],
			'wmu' 		=> $CONF['WMU'],
			'wme' 		=> $CONF['WME'],
			'wmb' 		=> $CONF['WMB'],
			'EasyPay'	=> $CONF['EasyPay'],
			'yandex'	=> $CONF['YandexMoney'],
			'x_donation'	=> $CONF['x_donation'],
		));

		$this->display('page.donation.tpl');
	}
}
?>